<template>
	<view class="fujin">
		
		<view class="lists" v-for="(item,index) in list">
			<view class="list" v-if="puid==0">
				<view class="fa">
					<view>{{item.nickname}}333333333</view>
				</view>
			</view>
			<view class="list">
			
				<view class="fa">
					留言时间：
					<view>{{item.create_time}}</view>
				</view>
			</view>
			<view class="list" >
			
				<image v-if="item.img&&item.img!='../../../static/upload.png'" :src="item.img" style="width: 60px;margin-left: 40rpx;margin-bottom: 10px;" mode="widthFix"></image>
				<view class="fa" >
					留言内容：
				
						{{item.content?item.content:"-"}}
				
				</view>
			</view>
			
			<view class="list">
				<view class="fa" style="font-size: 22rpx;">
					备注：{{item.title?item.title:"-"}}
				</view>
				
			</view>
			
			
		</view>
		
	</view>
</template>

<script>
    import Tabbar from '@/components/tabbar/tabbar.vue'
	import uniPopup from "@/components/uni-popup/uni-popup.vue";
	export default {
        components: {
            'view-tabbar': Tabbar, uniPopup
        }, 
		data() {
			return {
			
				list: [], //我的报名
				total: 0, //总条数
				page: 1, //当前页数
				nodata: false, //是否有数据
				lang:0,
				dev_name:"",
				info:[],
				puid:0,
				
			};
		},
		onLoad(ops) {
			this.puid = ops.id
			this.getList();
		},
		onReachBottom() {
		
				this.page++;
				this.getList();
		
		},
		onShow() {
			let _this = this;
			
			if(uni.getStorageSync('lang')){
				this.lang =  uni.getStorageSync('lang');
			}
			
			if(this.lang == 1){
				uni.setNavigationBarTitle({
						 title: 'People in the vicinity'
				})
			}else{
				uni.setNavigationBarTitle({
					   title: '附近的人'
				})
			}
		},
		methods: {
			miaoshu(){
				//留言内容必填
				if(this.dev_name.length<0 || this.dev_name == " " || this.dev_name == "   " 
				|| this.dev_name == "    " || this.dev_name == "    " || this.dev_name == "     "
				
				|| this.dev_name == "         " || this.dev_name == "       " || this.dev_name == "      "
				){
					if(this.lang==0){
						uni.showToast({
							title: '请输入内容',
							icon:"none"
						})
					}else{
						uni.showToast({
							title: 'Please enter the content',
							icon:"none"
						})
					}
					return;
				}
				
				let _this = this;
				console.log(this.info.uid,this.dev_name);
				this.$api.request('/api/user/liuyan', {
					content:this.dev_name,
					id:this.info.uid
				}, this.$store.state.token, function(res){
					if(res.code == 1) {
						if(_this.lang==0){
							uni.showToast({
								title: '操作成功',
								icon:"none"
							})
						}else{
							uni.showToast({
								title: 'Operation successful',
								icon:"none"
							})
						}
					}
					_this.$refs.popup2.close();
					_this.dev_name = "";
				});
				
				
			},
			liuyan(item){
					this.info = item;
					this.dev_name = "";
					this.$refs.popup2.open();
			},
			getList() {
				let _this = this;
				this.$api.request('/api/user/fujin_list', {
					page: this.page,
					puid:this.puid,
				}, this.$store.state.token, function(res){
					if(res.code == 1) {
						if(_this.page == 1) {
							_this.list = res.data.data;
						}else {
							_this.list = _this.list.concat(res.data.data);
						}
						_this.total = res.data.total_item_count;
						if(_this.list.length > 0) {
							_this.nodata = false;
						}else {
							_this.nodata = true;
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fujin{
		background: #111823;
		min-height: 100vh;
		float: left;
		width: 100%;
		
		.share-wrapper1{
			height: 300rpx;;
			width:500rpx;
			z-index:9991;
			border-radius: 16rpx 16rpx 0 0;
			background: #111823;
		    border-radius: 0.8em;
			font-size: 30rpx;
			.tp{
				width: 100%;
				text-align: center;
				color: #fff;
				padding-top: 30rpx;;
			}
			.nav_tex{
				margin-bottom: 30rpx;
				margin-top: 20rpx;
				width: 88%;
				margin-left: 6%;
				input{
					margin-top: 10rpx;
					padding: 5px;
					background: #2c3747;
					border-radius: 0.5em;
					height:50rpx;
					line-height: 50rpx
				}
				textarea{
					width: 100%;
					color: #fff;
					font-size: 24rpx;
					background: #293241;
					height: 160rpx;
					padding: 5px;
				}
			}
			
			.bom{
				float: left;
				margin-top: 20rpx;
				width: 94%;
				margin-left: 3%;
				.left{
					color: #fff;
					float: left;
				}
				.right{
					float: right;
					margin-right: 20rpx;
					color: #fff;
					width: 180rpx;
					text-align: center;
					height: 70rpx;
					line-height:70rpx;
		
				}
				
			}
			.bomt{
				// float: left;
				margin: 0 auto;
				margin-top: 20rpx;
				width: 90%;
				text-align: center;
				background: #5F83F4;
				border-radius: 0.2em;
				height: 70rpx;;
				line-height: 70rpx;;
				color: #fff;
				margin-bottom: 20rpx;
				margin-left: 5%;
			}
			
		}
		.rightimg_str1{
		
			width: 146rpx;;
			color:#fff;
			height: 40rpx;
			line-height: 40rpx;
			font-size: 22rpx;
			background: #44b31d;
			border-radius: 5em;
			text-align: center;
			font-weight: 500;
			margin-left: 20rpx;
			float: left;
			color: #fff;
			&:last-child{
				background: orange;
			}
		}
		.lists{
			padding-top:10rpx;
			padding-bottom: 20rpx;
			margin-top: 10px;;
			width: 100%;
			background: #293241;
			box-shadow: 0 0 10rpx 0 rgba(118, 156, 255, 0.3);
			float: left;
			.list{
				padding-top: 20rpx;
				width: 100%;;
				color:#7A818E;
				float: left;
				font-size: 30rpx;
				
				&:last-child{
					border-bottom: none;
				}
				.fa{
					font-weight: 500;
					margin-left:55rpx;
					float: left;
					color: #fff;
				}
				.icon{
					margin-right: 16rpx;
					width: 68rpx;
					height: 68rpx;
					float: left;
				}
				.rightimg_str{
					color:#fff;
					float:right;
					margin-right: 20px
				}
			}
		}
		
		
	}

	
</style>
